<template>
  <!-- 面试技巧 -->
  <div class="detail" @click="$router.push(`/shareDetail/${item.id}`)">
    <div class="content">
      <h4>{{ item.title }}</h4>
      <div class="introduce">
        {{ item.content }}
      </div>
      <div class="other">
        <div class="user">
          <img
            :src="
              item.author.avatar != null ? baseURL + item.author.avatar : imgUrl
            "
            alt=""
          />
          <span>{{ item.author.nickname }}</span>
        </div>
        <div class="time">{{ item.created_at | formaTime }}</div>
        <div class="mes">
          <i class="iconfont iconicon_pinglunliang"></i>
          <span>{{ item.article_comments }}</span>
        </div>
        <div class="zan">
          <i class="iconfont iconicon_dianzanliang"></i>
          <span>{{ item.star }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from 'moment'
export default {
  props: ['item'],
  data () {
    return {
      baseURL: process.env.VUE_APP_URL,
      imgUrl:
        'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1396521707,1973816781&fm=26&gp=0.jpg'
    }
  },
  filters: {
    formaTime (val) {
      return moment(val).format('YYYY-MM-DD')
    }
  }
}
</script>

<style lang="less">
.detail {
  .content {
    padding: 0 15px;
    h4 {
      font-size: 16px;
      font-weight: normal;
      margin: 40px 0 10px 0;
      color: #000;
    }
    .introduce {
      font-size: 14px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
      color: #5c5d76;
    }
    .other {
      margin-top: 10px;
      align-items: center;
      display: flex;
      justify-content: space-between;
      color: #b4b4bd;
      line-height: 25px;
      .user {
        img {
          width: 22px;
          height: 22px;
          border-radius: 50%;
          vertical-align: middle;
        }
        span {
          font-size: 10px;
          margin-left: 10px;
        }
      }
      .time {
        padding-top: 5px;
        font-size: 12px;
        box-sizing: border-box;
      }
      .mes {
        i {
          font-size: 12px;
        }
        span {
          margin-left: 5px;
          font-size: 12px;
        }
      }
      .zan {
        i {
          font-size: 12px;
        }
        span {
          margin-left: 5px;
          font-size: 12px;
        }
      }
    }
  }
}
</style>
